package com.tanhua.server.controller;

import com.tanhua.model.vo.SoulVo;
import com.tanhua.server.service.SoulService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/testSoul")
public class SoulController {
    @Autowired
    private SoulService soulService;

    @GetMapping
    public ResponseEntity getTestSoul(){
        List<SoulVo> vos=soulService.getTestSoul();
        return ResponseEntity.ok(vos);
    }

    @PostMapping
    public ResponseEntity postTestSoul(@RequestBody Map answers){
        List<HashMap> answerList = (List<HashMap>) answers.get("answers");
        //String optionId = (String) answerList.get("optionId");
        soulService.postTestSoul(answerList);
        return ResponseEntity.ok(null);
    }
}
